<!DOCTYPE HTML>
<!--
	Dimension by HTML5 UP
	html5up.net | @ajlkn
	Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
 <head>
  <title>
   Dimension by HTML5 UP
  </title>
  <!-- <meta charset="utf-8" /> -->
  <!-- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> -->
  <meta charset="utf-8"/>
  <meta content="width=device-width,initial-scale=1.0" name="viewport"/>
  <link href="../../assets/css/article.css" rel="stylesheet"/>
  <link href="https://cdn.bootcss.com/highlight.js/9.15.8/styles/github.min.css" rel="stylesheet"/>
  <noscript>
   <link href="../../assets/css/noscript.css" rel="stylesheet"/>
  </noscript>
 </head>
 <body>
  <div id="app">
  </div>
  <!-- built files will be auto injected -->
 </body>
 <body class="is-preload">
  <!-- Wrapper -->
  <div id="wrapper">
   <!-- Main -->
   <div id="main">
    <article id="article">
     <h1 id="redis-cluster">
      Redis Cluster 配置
     </h1>
     <hr/>
     <h2 id="_1">
      简介
     </h2>
     <p>
      在 Centos8 上部署 redis Cluster
     </p>
     <p>
      <em>
       这里就写一个大概，比较好的，可以参考后面的链接，进行更详细，完整的设置
      </em>
     </p>
     <h3 id="_2">
      配置详情与记录
     </h3>
     <div class="codehilite">
      <pre><span></span><code><span class="c1"># 安装</span>
dnf module install redis -y

<span class="c1"># 修改配置文件</span>
cp /etc/redis.conf /etc/redis.conf.orig
vi /etc/redis.conf

<span class="c1"># 修改内容如下</span>
<span class="nb">bind</span>  <span class="m">10</span>.42.0.247
protected-mode no
port <span class="m">6379</span>
cluster-enabled yes
cluster-config-file nodes-6379.conf
cluster-node-timeout <span class="m">15000</span>

<span class="c1"># 启动</span>
systemctl restart redis
cat /var/log/redis/redis.log

<span class="c1"># 下面的6380,6381,6382,6383,6384按照上面配置好以后，进行下面命令</span>
redis-cli --cluster create <span class="m">192</span>.168.101.105:6379 <span class="m">192</span>.168.101.105:6380 <span class="m">192</span>.168.101.105:6381 <span class="m">192</span>.168.101.105:6382 <span class="m">192</span>.168.101.105:6383 <span class="m">192</span>.168.101.105:6384 --cluster-replicas
redis-cli -h <span class="m">192</span>.168.101.105 -p <span class="m">6379</span> cluster nodes
redis-cli -h <span class="m">192</span>.168.101.105 -p <span class="m">6379</span> cluster nodes  <span class="p">|</span> grep master
redis-cli -h <span class="m">192</span>.168.101.105 -p <span class="m">6379</span> cluster nodes  <span class="p">|</span> grep slave
</code></pre>
     </div>
     <h2 id="_3">
      参考链接
     </h2>
     <ul>
      <li>
       <a href="https://blog.csdn.net/baidu_27627251/article/details/112143714">
        Windows下部署redis主从、哨兵（sentinel）、集群（cluster）
       </a>
      </li>
      <li>
       <a href="https://github.com/Johar77/JAVA-000/tree/main/Week_12">
        配置 redis 的主从复制，sentinel 高可用，Cluster 集群
       </a>
      </li>
     </ul>
    </article>
   </div>
   <!-- Footer -->
   <footer id="footer">
    <p class="copyright">
     © Untitled. Design:
     <a href="https://html5up.net">
      HTML5 UP
     </a>
     .
    </p>
   </footer>
  </div>
  <!-- BG -->
  <div id="bg">
  </div>
  <!-- Scripts -->
  <script src="../assets/js/jquery.min.js">
  </script>
  <script src="../assets/js/browser.min.js">
  </script>
  <script src="../assets/js/breakpoints.min.js">
  </script>
  <script src="../assets/js/util.js">
  </script>
  <script src="../assets/js/main.js">
  </script>
 </body>
</html>
